#!/usr/bin/env sh

# For the wrekagrid project
# Basile Clout, October 2007

pref=$1				# Prefix of the gts file
nb=$2				# Number of partitions
size=$3				# Radius of the spheres

echo $pref

gts2mesh=/Users/basileclout/Desktop/repo/wcolor/vtk/node_gts/gts2mesh.pl
mesh2nodal=~/Desktop/partitioners/metis/metis-4.0/mesh2nodal
pmetis=~/Desktop/partitioners/metis/metis-4.0/pmetis
showmesh2=/Users/basileclout/Desktop/repo/wcolor/vtk/showmesh2.py

# Create mesh pref
$gts2mesh < ${pref}'.gts' > $pref'.mesh'

# Create graph
$mesh2nodal $pref'.mesh'

# Create partition
$pmetis $pref'.mesh.ngraph' $nb

# Output it
$showmesh2 -n gts -r vtk --vtk_rsphere $size --vtk_legend 0 ${pref}'.gts' ${pref}'.mesh.ngraph.part.'$nb

